<?php
/**
 * 系統名稱: Lotto 系統
 * 檔案說明: 專案管理-修改
 * $Author$
 * $Id$
 *
 */
$strHostName = $_data["HostName"];
$arrDirectID = $_data["arrDID"];
$strMemo = $_data["Memo"];

$arrHost = getVirtualHostByHostName($strHostName);
if($arrHost === false)ErrMsgOutputHTML("Error", "", 1);

if(sizeof($arrHost) > 0){
	$GLOBALS["errormessage"] = $data["HostName_x"]." ".$_strVirtualHost["HostNameExist"];//"已使用中，請更改！";
	ErrMsgOutputHTML("Error", "", 1);
}

$strDirectID = "";
if(is_array($arrDirectID))$strDirectID = join(",", $arrDirectID);

$intVHostID = addVirtualHostData($strHostName, $strDirectID, $strMemo);
if($intVHostID === false){
	ErrMsgOutputHTML("Error", "", 1);
}

$strLog = "ID：".$intVHostID."\n";
$strLog .= "HostName：".$strHostName."\n";
$strLog .= "DirectID：".$strDirectID."\n";
$strLog .= "Memo：".$strMemo."\n";
AddData_Log("", "新增網域總監對應資料", $strLog);

if(!getVirtualHostDataFile()){
	$strLog .= $GLOBALS["errormessage"]."\n";
	$strLog .= $GLOBALS["errorhidden"]."\n";
	$objLog -> AddLog("","產生網域總監對應資料檔案錯誤", $strLog);

	ErrMsgOutputHTML("Error", "", 1);
}
header("Location: index.php?op=List");
?>